<template>
  <j-modal
    switchFullscreen
    :title="title"
    :width="1200"
    :visible="visible"
    :maskClosable="false"
    :confirmLoading="confirmLoading"
    @ok="handleOk"
    @cancel="handleCancel"
    cancelText="关闭">
    <template slot="footer">
      <a-button @click="handleCancel">取消</a-button>
      <a-button type="primary" @click="handleOk" v-if="!disableSubmit">确认</a-button>
    </template>
    <a-spin :spinning="confirmLoading">
      <a-form :form="form">
        <a-row :gutter="24">
          <a-col :md="8" :sm="24">
            <a-form-item
              :labelCol="labelCol"
              :wrapperCol="wrapperCol"
              label="经销商编号"
            >
              <a-input :disabled="disableSubmit" placeholder="请输入"
                       v-decorator="['customerCode',validatorRules.terminalName ]"/>
            </a-form-item>
          </a-col>
          <a-col :md="8" :sm="24">
            <a-form-item
              :labelCol="labelCol"
              :wrapperCol="wrapperCol"
              label="经销商名称"
            >
              <a-input :disabled="disableSubmit" placeholder="请输入" v-decorator="['customerName', ]"/>
            </a-form-item>
          </a-col>
          <a-col :md="8" :sm="24">
            <a-form-item
              :labelCol="labelCol"
              :wrapperCol="wrapperCol"
              label="合作方式"
              >
              <cn-dict-select-tag
                triggerChange
                dictCode="cpt_manner"
                :disabled="disableSubmit"
                placeholder="请选择"
                :options="{value:'dictDataCode',label:'dictDataDesc'}"
                v-decorator.trim="['cooperationWayCode', validatorRules.cooperationWayCode]"/>
            </a-form-item>
          </a-col>
          <a-col :md="8" :sm="24">
            <a-form-item
              :labelCol="labelCol"
              :wrapperCol="wrapperCol"
              label="组织编号"
            >
              <a-input :disabled="disableSubmit" placeholder="请输入" v-decorator="['departCode', ]"/>
            </a-form-item>
          </a-col>
          <a-col :md="8" :sm="24">
            <a-form-item
              :labelCol="labelCol"
              :wrapperCol="wrapperCol"
              label="组织名称"
            >
              <a-input :disabled="disableSubmit" placeholder="请输入" v-decorator="['departName', ]"/>
            </a-form-item>
          </a-col>
          <a-col :md="8" :sm="24">
            <a-form-item
              :labelCol="labelCol"
              :wrapperCol="wrapperCol"
              label="库存组织"
            >
              <a-input :disabled="disableSubmit" placeholder="请输入" v-decorator="['inventoryOrg', ]"/>
            </a-form-item>
          </a-col>
          <a-col :md="8" :sm="24">
            <a-form-item
              :labelCol="labelCol"
              :wrapperCol="wrapperCol"
              label="状态"
            >
              <a-select
                v-decorator.trim="[ 'status']"
                :disabled="disableSubmit"
                placeholder="请选择"
              >
                <a-select-option :value="1">
                  启用
                </a-select-option>
                <a-select-option :value="0">
                  停用
                </a-select-option>
              </a-select>
              <!--              <a-input :disabled="disableSubmit"  placeholder='请输入' v-decorator="['customerName', ]" />-->
            </a-form-item>
          </a-col>
          <a-col :md="8" :sm="24">
            <a-form-item
              :labelCol="labelCol"
              :wrapperCol="wrapperCol"
              label="主营品牌"
            >
              <a-input :disabled="disableSubmit" placeholder="请输入" v-decorator="['mainBrand', ]"/>
            </a-form-item>
          </a-col>
          <a-col :md="8" :sm="24">
            <a-form-item
              :labelCol="labelCol"
              :wrapperCol="wrapperCol"
              label="法定代表人"
            >
              <a-input :disabled="disableSubmit" placeholder="请输入" v-decorator="['legalPerson', ]"/>
            </a-form-item>
          </a-col>
          <a-col :md="8" :sm="24">
            <a-form-item
              :labelCol="labelCol"
              :wrapperCol="wrapperCol"
              label="法人手机号"
            >
              <a-input :disabled="disableSubmit" placeholder="请输入" v-decorator="['legalPersonPhone', ]"/>
            </a-form-item>
          </a-col>
          <a-col :md="8" :sm="24">
            <a-form-item
              :labelCol="labelCol"
              :wrapperCol="wrapperCol"
              label="法定身份证号"
            >
              <a-input :disabled="disableSubmit" placeholder="请输入" v-decorator="['legalPersonCard', ]"/>
            </a-form-item>
          </a-col>
          <a-col :md="8" :sm="24">
            <a-form-item
              :labelCol="labelCol"
              :wrapperCol="wrapperCol"
              label="企业性质"
            >
              <a-input :disabled="disableSubmit" placeholder="请输入" v-decorator="['enterNature', ]"/>
            </a-form-item>
          </a-col>
          <a-col :md="8" :sm="24">
            <a-form-item
              :labelCol="labelCol"
              :wrapperCol="wrapperCol"
              label="社会信用代码"
            >
              <a-input :disabled="disableSubmit" placeholder="请输入" v-decorator="['creditCode', ]"/>
            </a-form-item>
          </a-col>
          <a-col :md="8" :sm="24">
            <a-form-item
              :labelCol="labelCol"
              :wrapperCol="wrapperCol"
              label="食品流通许可证编号"
            >
              <a-input :disabled="disableSubmit" placeholder="请输入" v-decorator="['foodCirLicense', ]"/>
            </a-form-item>
          </a-col>
          <a-col :md="8" :sm="24">
            <a-form-item
              :labelCol="labelCol"
              :wrapperCol="wrapperCol"
              label="营业执照上次年审时间"
            >
              <a-date-picker :disabled="disableSubmit" placeholder="营业执照上次年审时间"
                             format="YYYY-MM-DD" valueFormat="YYYY-MM-DD"
                             v-decorator="['lastCarefulTime', ]" style="width:100%"/>
            </a-form-item>
          </a-col>
          <a-col :md="8" :sm="24">
            <a-form-item
              :labelCol="labelCol"
              :wrapperCol="wrapperCol"
              label="合作时间"
            >
              <a-date-picker :disabled="disableSubmit" placeholder="合作时间"
                             format="YYYY-MM-DD" valueFormat="YYYY-MM-DD"
                             v-decorator="['cooperationTime', ]" style="width:100%"/>
            </a-form-item>
          </a-col>
          <a-col :md="8" :sm="24">
            <a-form-item
              :labelCol="labelCol"
              :wrapperCol="wrapperCol"
              label="企业注册地址"
            >
              <a-input :disabled="disableSubmit" placeholder="请输入" v-decorator="['enterRegisterAddress', ]"/>
            </a-form-item>
          </a-col>
          <a-col :md="8" :sm="24">
            <a-form-item
              :labelCol="labelCol"
              :wrapperCol="wrapperCol"
              label="注册资金(万元)"
            >
              <a-input :disabled="disableSubmit" placeholder="请输入" v-decorator="['enterRegisterMoney', ]"/>
            </a-form-item>
          </a-col>
          <!--          行政区域-->
          <a-col :md="8" :sm="24">
            <a-form-item
              :labelCol="labelCol"
              :wrapperCol="wrapperCol"
              label="所在行政区域"
            >
              <cn-area-linkage v-model="belongRegion"
                               type="cascader"
                               :province.sync="form.province"
                               :disabled="disableSubmit"
                               placeholder="请选择"
                               :city.sync="form.city"
                               :area.sync="form.area"
                               @change="handlePca"/>
            </a-form-item>
          </a-col>
          <a-col :md="8" :sm="24">
            <a-form-item
              :labelCol="labelCol"
              :wrapperCol="wrapperCol"
              label="企业电话"
            >
              <a-input :disabled="disableSubmit" placeholder="请输入" v-decorator="['enterTel', ]"/>
            </a-form-item>
          </a-col>
          <a-col :md="8" :sm="24">
            <a-form-item
              :labelCol="labelCol"
              :wrapperCol="wrapperCol"
              label="邮政编号"
            >
              <a-input :disabled="disableSubmit" placeholder="请输入" v-decorator="['postalCode', ]"/>
            </a-form-item>
          </a-col>

          <a-col :md="8" :sm="24">
            <a-form-item
              :labelCol="labelCol"
              :wrapperCol="wrapperCol"
              label="年合同任务(万元)"
            >
              <a-input :disabled="disableSubmit" placeholder="请输入" v-decorator="['yearContractTask', ]"/>
            </a-form-item>
          </a-col>


          <a-col :md="8" :sm="24">
            <a-form-item
              :labelCol="labelCol"
              :wrapperCol="wrapperCol"
              label="最大可同行车型编号"
            >
              <a-input :disabled="disableSubmit" placeholder="请输入" v-decorator="['maxAllowPeerCarCode', ]"/>
            </a-form-item>
          </a-col>
          <a-col :md="8" :sm="24">
            <a-form-item
              :labelCol="labelCol"
              :wrapperCol="wrapperCol"
              label="最大可同行车型"
            >
              <a-input :disabled="disableSubmit" placeholder="请输入" v-decorator="['maxAllowPeerCarName', ]"/>
            </a-form-item>
          </a-col>
          <a-col :md="8" :sm="24">
            <a-form-item
              :labelCol="labelCol"
              :wrapperCol="wrapperCol"
              label="冷库容积(平方米)"
            >
              <a-input :disabled="disableSubmit" placeholder="请输入" v-decorator="['coldStorageArea', ]"/>
            </a-form-item>
          </a-col>
          <a-col :md="8" :sm="24">
            <a-form-item
              :labelCol="labelCol"
              :wrapperCol="wrapperCol"
              label="冷藏车辆数"
            >
              <a-input :disabled="disableSubmit" placeholder="请输入" v-decorator="['coldCarNum', ]"/>
            </a-form-item>
          </a-col>
          <a-col :md="8" :sm="24">
            <a-form-item
              :labelCol="labelCol"
              :wrapperCol="wrapperCol"
              label="年总营业额(元)"
            >
              <a-input :disabled="disableSubmit" placeholder="请输入" v-decorator="['yearTotalTurnover', ]"/>
            </a-form-item>
          </a-col>
          <a-col :md="8" :sm="24">
            <a-form-item
              :labelCol="labelCol"
              :wrapperCol="wrapperCol"
              label="经销商等级"
            >
              <a-input :disabled="disableSubmit" placeholder="请输入" v-decorator="['customerLevel', ]"/>
            </a-form-item>
          </a-col>
          <a-col :md="8" :sm="24">
            <a-form-item
              :labelCol="labelCol"
              :wrapperCol="wrapperCol"
              label="是否代配送商"
            >
              <a-radio-group :disabled="disableSubmit" v-decorator="['isTransportMerchants', ]">
                <a-radio :value="1">
                  是
                </a-radio>
                <a-radio :value="0">
                  否
                </a-radio>
              </a-radio-group>
            </a-form-item>
          </a-col>
          <a-col :md="8" :sm="24">
            <a-form-item
              :labelCol="labelCol"
              :wrapperCol="wrapperCol"
              label="代配送经销商编号"
            >
              <a-input :disabled="disableSubmit" placeholder="请输入" v-decorator="['transportCustomerCode', ]"/>
            </a-form-item>
          </a-col>
          <a-col :md="8" :sm="24">
            <a-form-item
              :labelCol="labelCol"
              :wrapperCol="wrapperCol"
              label="代配送经销商"
            >
              <a-input :disabled="disableSubmit" placeholder="请输入" v-decorator="['transportCustomerName', ]"/>
            </a-form-item>
          </a-col>
          <a-col :md="8" :sm="24">
            <a-form-item
              :labelCol="labelCol"
              :wrapperCol="wrapperCol"
              label="车型控制"
            >
              <a-radio-group :disabled="disableSubmit" v-decorator="['isModelsControl', ]">
                <a-radio :value="1">
                  是
                </a-radio>
                <a-radio :value="0">
                  否
                </a-radio>
              </a-radio-group>
            </a-form-item>
          </a-col>
          <a-col :md="8" :sm="24">
            <a-form-item
              :labelCol="labelCol"
              :wrapperCol="wrapperCol"
              label="最小批量控制"
            >
              <a-radio-group :disabled="disableSubmit" v-decorator="['isMinBatchControl', ]">
                <a-radio :value="1">
                  是
                </a-radio>
                <a-radio :value="0">
                  否
                </a-radio>
              </a-radio-group>
            </a-form-item>
          </a-col>
          <a-col :md="8" :sm="24">
            <a-form-item
              :labelCol="labelCol"
              :wrapperCol="wrapperCol"
              label="计划控制"
            >
              <a-radio-group :disabled="disableSubmit" v-decorator="['isPlanControl', ]">
                <a-radio :value="1">
                  是
                </a-radio>
                <a-radio :value="0">
                  否
                </a-radio>
              </a-radio-group>
            </a-form-item>
          </a-col>
          <a-col :md="8" :sm="24">
            <a-form-item
              :labelCol="labelCol"
              :wrapperCol="wrapperCol"
              label="经销商类型"
            >
              <a-input :disabled="disableSubmit" placeholder="请输入" v-decorator="['customerTypeCode', ]"/>
            </a-form-item>
          </a-col>
          <a-col :md="8" :sm="24">
            <a-form-item
              :labelCol="labelCol"
              :wrapperCol="wrapperCol"
              label="信贷控制"
            >
              <a-radio-group :disabled="disableSubmit" v-decorator="['isCreditControl', ]">
                <a-radio :value="1">
                  是
                </a-radio>
                <a-radio :value="0">
                  否
                </a-radio>
              </a-radio-group>
            </a-form-item>
          </a-col>
          <a-col :md="8" :sm="24">
            <a-form-item
              :labelCol="labelCol"
              :wrapperCol="wrapperCol"
              label="经销商负责区域/渠道"
            >
              <a-input :disabled="disableSubmit" placeholder="请输入" v-decorator="['customerChargeArea', ]"/>
            </a-form-item>
          </a-col>
          <a-col :md="8" :sm="24">
            <a-form-item
              :labelCol="labelCol"
              :wrapperCol="wrapperCol"
              label="经营竞品"
            >
              <a-input :disabled="disableSubmit" placeholder="请输入" v-decorator="['businessCompetGoods', ]"/>
            </a-form-item>
          </a-col>
          <a-col :md="8" :sm="24">
            <a-form-item
              :labelCol="labelCol"
              :wrapperCol="wrapperCol"
              label="经销区域分类"
            >
              <a-input :disabled="disableSubmit" placeholder="请输入" v-decorator="['businessAreaClassify', ]"/>
            </a-form-item>
          </a-col>
          <a-col :md="8" :sm="24">
            <a-form-item
              :labelCol="labelCol"
              :wrapperCol="wrapperCol"
              label="是否VIP"
            >
              <a-radio-group :disabled="disableSubmit" v-decorator="['isVip', ]">
                <a-radio :value="1">
                  是
                </a-radio>
                <a-radio :value="0">
                  否
                </a-radio>
              </a-radio-group>
            </a-form-item>
          </a-col>
          <a-col :md="8" :sm="24">
            <a-form-item
              :labelCol="labelCol"
              :wrapperCol="wrapperCol"
              label="付款条件"
            >
              <a-input :disabled="disableSubmit" placeholder="请输入" v-decorator="['payConditionCode', ]"/>
            </a-form-item>
          </a-col>
          <a-col :md="8" :sm="24">
            <a-form-item
              :labelCol="labelCol"
              :wrapperCol="wrapperCol"
              label="公司代码"
            >
              <a-input :disabled="disableSubmit" placeholder="请输入" v-decorator="['companyCode', ]"/>
            </a-form-item>
          </a-col>

          <a-col :md="8" :sm="24">
            <a-form-item
              :labelCol="labelCol"
              :wrapperCol="wrapperCol"
              label="默认发货地编号"
            >
              <a-input :disabled="disableSubmit" placeholder="请输入" v-decorator="['defaultDeliveryAddressCode', ]"/>
            </a-form-item>
          </a-col>
          <a-col :md="8" :sm="24">
            <a-form-item
              :labelCol="labelCol"
              :wrapperCol="wrapperCol"
              label="默认发货地"
            >
              <a-input :disabled="disableSubmit" placeholder="请输入" v-decorator="['defaultDeliveryAddress', ]"/>
            </a-form-item>
          </a-col>

          <a-col :md="8" :sm="24">
            <a-form-item
              :labelCol="labelCol"
              :wrapperCol="wrapperCol"
              label="默认发货地2编号"
            >
              <a-input :disabled="disableSubmit" placeholder="请输入" v-decorator="['defaultDeliveryAddress2Code', ]"/>
            </a-form-item>
          </a-col>
          <a-col :md="8" :sm="24">
            <a-form-item
              :labelCol="labelCol"
              :wrapperCol="wrapperCol"
              label="默认发货地2"
            >
              <a-input :disabled="disableSubmit" placeholder="请输入" v-decorator="['defaultDeliveryAddress2', ]"/>
            </a-form-item>
          </a-col>

          <a-col :md="8" :sm="24">
            <a-form-item
              :labelCol="labelCol"
              :wrapperCol="wrapperCol"
              label="价格清单类型"
            >
              <a-input :disabled="disableSubmit" placeholder="请输入" v-decorator="['priceGroupCode', ]"/>
            </a-form-item>
          </a-col>
          <a-col :md="8" :sm="24">
            <a-form-item
              :labelCol="labelCol"
              :wrapperCol="wrapperCol"
              label="是否团购户"
            >
              <a-radio-group :disabled="disableSubmit" v-decorator="['isGroupPurchase', ]">
                <a-radio :value="1">
                  是
                </a-radio>
                <a-radio :value="0">
                  否
                </a-radio>
              </a-radio-group>
            </a-form-item>
          </a-col>
          <a-col :md="8" :sm="24">
            <a-form-item
              :labelCol="labelCol"
              :wrapperCol="wrapperCol"
              label="办公地址"
            >
              <a-input :disabled="disableSubmit" placeholder="请输入" v-decorator="['officeAddress', ]"/>
            </a-form-item>
          </a-col>
          <a-col :md="8" :sm="24">
            <a-form-item
              :labelCol="labelCol"
              :wrapperCol="wrapperCol"
              label="工厂编号"
            >
              <a-input :disabled="disableSubmit" placeholder="请输入" v-decorator="['factoryCode', ]"/>
            </a-form-item>
          </a-col>
          <a-col :md="8" :sm="24">
            <a-form-item
              :labelCol="labelCol"
              :wrapperCol="wrapperCol"
              label="工厂"
            >
              <a-input :disabled="disableSubmit" placeholder="请输入" v-decorator="['factory', ]"/>
            </a-form-item>
          </a-col>
          <a-col :md="8" :sm="24">
            <a-form-item
              :labelCol="labelCol"
              :wrapperCol="wrapperCol"
              label="业务联系人"
            >
              <a-input :disabled="disableSubmit" placeholder="请输入" v-decorator="['businessContact', ]"/>
            </a-form-item>
          </a-col>
          <a-col :md="8" :sm="24">
            <a-form-item
              :labelCol="labelCol"
              :wrapperCol="wrapperCol"
              label="业务联系人电话"
            >
              <a-input :disabled="disableSubmit" placeholder="请输入" v-decorator="['businessContactTel', ]"/>
            </a-form-item>
          </a-col>
          <a-col :md="8" :sm="24">
            <a-form-item
              :labelCol="labelCol"
              :wrapperCol="wrapperCol"
              label="门店类型"
            >
              <a-input :disabled="disableSubmit" placeholder="请输入" v-decorator="['terminalType', ]"/>
            </a-form-item>
          </a-col>
          <a-col :md="8" :sm="24">
            <a-form-item
              :labelCol="labelCol"
              :wrapperCol="wrapperCol"
              label="财务联系人"
            >
              <a-input :disabled="disableSubmit" placeholder="请输入" v-decorator="['financialContact', ]"/>
            </a-form-item>
          </a-col>
          <a-col :md="8" :sm="24">
            <a-form-item
              :labelCol="labelCol"
              :wrapperCol="wrapperCol"
              label="财务联系人电话"
            >
              <a-input :disabled="disableSubmit" placeholder="请输入" v-decorator="['financialContactTel', ]"/>
            </a-form-item>
          </a-col>
          <a-col :md="8" :sm="24">
            <a-form-item
              :labelCol="labelCol"
              :wrapperCol="wrapperCol"
              label="账期天数"
            >
              <a-input :disabled="disableSubmit" placeholder="请输入" v-decorator="['paymentDays', ]"/>
            </a-form-item>
          </a-col>
          <a-col :md="8" :sm="24">
            <a-form-item
              :labelCol="labelCol"
              :wrapperCol="wrapperCol"
              label="付款方"
            >
              <a-input :disabled="disableSubmit" placeholder="请输入" v-decorator="['payerName', ]"/>
            </a-form-item>
          </a-col>
          <a-col :md="8" :sm="24">
            <a-form-item
              :labelCol="labelCol"
              :wrapperCol="wrapperCol"
              label="经销商组编号"
            >
              <a-input :disabled="disableSubmit" placeholder="请输入" v-decorator="['customerGroupCode', ]"/>
            </a-form-item>
          </a-col>
          <a-col :md="8" :sm="24">
            <a-form-item
              :labelCol="labelCol"
              :wrapperCol="wrapperCol"
              label="经销商组"
            >
              <a-input :disabled="disableSubmit" placeholder="请输入" v-decorator="['customerGroupName', ]"/>
            </a-form-item>
          </a-col>
          <a-col :md="8" :sm="24">
            <a-form-item
              :labelCol="labelCol"
              :wrapperCol="wrapperCol"
              label="系统网站"
            >
              <a-input :disabled="disableSubmit" placeholder="请输入" v-decorator="['systemWebSite', ]"/>
            </a-form-item>
          </a-col>
          <a-col :md="8" :sm="24">
            <a-form-item
              :labelCol="labelCol"
              :wrapperCol="wrapperCol"
              label="促销员/理货员编号"
            >
              <a-input :disabled="disableSubmit" placeholder="请输入" v-decorator="['promotersCode', ]"/>
            </a-form-item>
          </a-col>
          <a-col :md="8" :sm="24">
            <a-form-item
              :labelCol="labelCol"
              :wrapperCol="wrapperCol"
              label="促销员/理货员"
            >
              <a-input :disabled="disableSubmit" placeholder="请输入" v-decorator="['promoters', ]"/>
            </a-form-item>
          </a-col>
          <a-col :md="8" :sm="24">
            <a-form-item
              :labelCol="labelCol"
              :wrapperCol="wrapperCol"
              label="促销/理货员电话"
            >
              <a-input :disabled="disableSubmit" placeholder="请输入" v-decorator="['promotersTel', ]"/>
            </a-form-item>
          </a-col>
          <a-col :md="8" :sm="24">
            <a-form-item
              :labelCol="labelCol"
              :wrapperCol="wrapperCol"
              label="是否工厂DC"
            >
              <a-radio-group :disabled="disableSubmit" v-decorator="['isFactoryDc', ]">
                <a-radio :value="1">
                  是
                </a-radio>
                <a-radio :value="0">
                  否
                </a-radio>
              </a-radio-group>
            </a-form-item>
          </a-col>
          <a-col :md="8" :sm="24">
            <a-form-item
              :labelCol="labelCol"
              :wrapperCol="wrapperCol"
              label="面积/托位"
            >
              <a-input :disabled="disableSubmit" placeholder="请输入" v-decorator="['acreage', ]"/>
            </a-form-item>
          </a-col>
          <a-col :md="8" :sm="24">
            <a-form-item
              :labelCol="labelCol"
              :wrapperCol="wrapperCol"
              label="日思念最大吞吐量"
            >
              <a-input :disabled="disableSubmit" placeholder="请输入" v-decorator="['maxThroughputMax', ]"/>
            </a-form-item>
          </a-col>
          <a-col :md="8" :sm="24">
            <a-form-item
              :labelCol="labelCol"
              :wrapperCol="wrapperCol"
              label="内部经销商联系人"
            >
              <a-input :disabled="disableSubmit" placeholder="请输入" v-decorator="['internalCustomerContact', ]"/>
            </a-form-item>
          </a-col>

          <a-col :md="8" :sm="24">
            <a-form-item
              :labelCol="labelCol"
              :wrapperCol="wrapperCol"
              label="货币类型"
            >
              <a-input :disabled="disableSubmit" placeholder="请输入" v-decorator="['currencyTypeCode', ]"/>
            </a-form-item>
          </a-col>
          <a-col :md="8" :sm="24">
            <a-form-item
              :labelCol="labelCol"
              :wrapperCol="wrapperCol"
              label="国家"
            >
              <a-input :disabled="disableSubmit" placeholder="请输入" v-decorator="['countries', ]"/>
            </a-form-item>
          </a-col>
          <a-col :md="8" :sm="24">
            <a-form-item
              :labelCol="labelCol"
              :wrapperCol="wrapperCol"
              label="仓库合作方"
            >
              <a-input :disabled="disableSubmit" placeholder="请输入" v-decorator="['warehousePartner', ]"/>
            </a-form-item>
          </a-col>
          <a-col :md="8" :sm="24">
            <a-form-item
              :labelCol="labelCol"
              :wrapperCol="wrapperCol"
              label="经销商分类"
            >
              <a-input :disabled="disableSubmit" placeholder="请输入" v-decorator="['customerClassifyName', ]"/>
            </a-form-item>
          </a-col>
          <a-col :md="8" :sm="24">
            <a-form-item
              :labelCol="labelCol"
              :wrapperCol="wrapperCol"
              label="经销商结算主体"
            >
              <a-input :disabled="disableSubmit" placeholder="请输入" v-decorator="['customerSettlementSubject', ]"/>
            </a-form-item>
          </a-col>
          <a-col :md="8" :sm="24">
            <a-form-item
              :labelCol="labelCol"
              :wrapperCol="wrapperCol"
              label="备注"
            >
              <a-input :disabled="disableSubmit" placeholder="请输入" v-decorator="['remarks', ]"/>
            </a-form-item>
          </a-col>
        </a-row>
      </a-form>
    </a-spin>
    <div style="display: flex;padding-left: 5.5%;border-top: 1px dashed #fefefe;padding-top:10px">
    </div>
    <a-tabs default-active-key="1" @change="callback">
      <a-tab-pane key="1" tab="财务信息">
        <div class="table-operator" v-if="!disableSubmit">
          <a-button @click='handleAddRow("financials")' type="primary">新增</a-button>
          <a-button @click="handleDeleteRow(1)" type="primary">删除</a-button>
        </div>
        <a-table
          bordered
          size="middle"
          :scroll="{
          x: 'max-content'
          }"
          rowKey="id"
          :rowSelection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange}"
          :data-source="financials"
          :columns="financialColumns"
          :pagination="false">
          <template slot="accountType" slot-scope="text, record, index">
            <a-select v-model="record.accountType" style="width: 100%" :disabled="disableSubmit" placeholder="公司账户">
              <a-select-option value="1">
                公司账户
              </a-select-option>
              <a-select-option value="2">
                个人账户
              </a-select-option>
            </a-select>
          </template>
          <template slot="customerBank" slot-scope="text, record, index">
            <a-input v-model="record.customerBank" :disabled="disableSubmit" placeholder="经销商银行开户名称" style="width: 100%">
            </a-input>
          </template>
          <template slot="customerBankAccount" slot-scope="text, record, index">
            <a-input v-model="record.customerBankAccount" :disabled="disableSubmit" placeholder="经销商银行账号（基本户）"
                     style="width: 100%">
            </a-input>
          </template>
          <template slot="makeInvoiceType" slot-scope="text, record, index">
            <a-select v-model="record.makeInvoiceType" style="width: 100%" :disabled="disableSubmit" placeholder="开票类型">
              <a-select-option value="1">
                增值税专用发票
              </a-select-option>
              <a-select-option value="2">
                增值税普通发票
              </a-select-option>
            </a-select>
          </template>
          <template slot="bankAccount" slot-scope="text, record, index">
            <a-input v-model="record.bankAccount" :disabled="disableSubmit" placeholder="银行卡号" style="width: 100%">
            </a-input>
          </template>
          <template slot="makeInvoiceName" slot-scope="text, record, index">
            <a-input v-model="record.makeInvoiceName" :disabled="disableSubmit" placeholder="经销商开票名称（营业执照）"
                     style="width: 100%">
            </a-input>
          </template>
          <template slot="isAgentSettlement" slot-scope="text, record, index">
            <a-select v-model="record.isAgentSettlement" style="width: 100%" :disabled="disableSubmit"
                      placeholder="是否代结算">
              <a-select-option :value="1">
                是
              </a-select-option>
              <a-select-option :value="0">
                否
              </a-select-option>
            </a-select>
          </template>
          <template slot="settlementWay" slot-scope="text, record, index">
            <a-select v-model="record.settlementWayCode" style="width: 100%" :disabled="disableSubmit"
                      placeholder="结算方式">
              <a-select-option value="1">
                按单结算
              </a-select-option>
              <a-select-option value="2">
                实销实结
              </a-select-option>
            </a-select>
          </template>
          <template slot="invoiceMailAddress" slot-scope="text, record, index">
            <a-input v-model="record.invoiceMailAddress" :disabled="disableSubmit" placeholder="发票邮寄地址"
                     style="width: 100%">
            </a-input>
          </template>
          <template slot="taxpayerType" slot-scope="text, record, index">
            <a-select v-model="record.taxpayerType" style="width: 100%" :disabled="disableSubmit" placeholder="纳税人类型">
              <a-select-option value="1">
                小规模纳税人
              </a-select-option>
              <a-select-option value="2">
                一般纳税人
              </a-select-option>
            </a-select>
          </template>
          <template slot="customerTaxpayerNum" slot-scope="text, record, index">
            <a-input v-model="record.customerTaxpayerNum" :disabled="disableSubmit" placeholder="经销商纳税人识别号"
                     style="width: 100%">
            </a-input>
          </template>
          <template slot="vatInvoiceTel" slot-scope="text, record, index">
            <a-input v-model="record.vatInvoiceTel" :disabled="disableSubmit" placeholder="增值税开票电话" style="width: 100%">
            </a-input>
          </template>
          <template slot="invoiceRecipients" slot-scope="text, record, index">
            <a-input v-model="record.invoiceRecipients" :disabled="disableSubmit" placeholder="发票收件人"
                     style="width: 100%">
            </a-input>
          </template>
          <template slot="invoiceRecipientsPhone" slot-scope="text, record, index">
            <a-input v-model="record.invoiceRecipientsPhone" :disabled="disableSubmit" placeholder="发票联系人手机号"
                     style="width: 100%">
            </a-input>
          </template>
          <template slot="invoiceRecipientsEmail" slot-scope="text, record, index">
            <a-input v-model="record.invoiceRecipientsEmail" :disabled="disableSubmit" placeholder="发票联系人电子邮箱"
                     style="width: 100%">
            </a-input>
          </template>
        </a-table>
      </a-tab-pane>
      <!--      <a-tab-pane key='2' tab='收货信息' force-render>-->
      <!--        <div class='table-operator'>-->
      <!--          <a-button @click='' type='primary'>新增</a-button>-->
      <!--          <a-button @click='' type='primary'>删除</a-button>-->
      <!--        </div>-->
      <!--        <a-table bordered-->
      <!--                 size='middle'-->
      <!--                 :scroll="{-->
      <!--                  x: 'max-content'-->
      <!--                  }"-->
      <!--                 :data-source='financials'-->
      <!--                 :columns='gAddColumns'-->
      <!--                 :pagination='false'>-->
      <!--          <template slot='deliveryCode' slot-scope='text, record, index'>-->
      <!--            <a-input v-model='record.deliveryCode' :disabled="disableSubmit"  placeholder='送达方编号' style='width: 100%'>-->
      <!--            </a-input>-->
      <!--          </template>-->
      <!--          <template slot='officeAddress' slot-scope='text, record, index'>-->
      <!--            <a-input v-model='record.officeAddress' :disabled="disableSubmit"  placeholder='办公地址' style='width: 100%'>-->
      <!--            </a-input>-->
      <!--          </template>-->
      <!--          <template slot='receivedGoodsAddress' slot-scope='text, record, index'>-->
      <!--            <a-input v-model='record.receivedGoodsAddress' :disabled="disableSubmit"  placeholder='收货地址' style='width: 100%'>-->
      <!--            </a-input>-->
      <!--          </template>-->
      <!--          <template slot='addressDetailed' slot-scope='text, record, index'>-->
      <!--            <a-input v-model='record.addressDetailed' :disabled="disableSubmit"  placeholder='详细地址' style='width: 100%'>-->
      <!--            </a-input>-->
      <!--          </template>-->
      <!--          <template slot='freightCalCity' slot-scope='text, record, index'>-->
      <!--            <a-input v-model='record.freightCalCity' :disabled="disableSubmit"  placeholder='运费计算城市' style='width: 100%'>-->
      <!--            </a-input>-->
      <!--          </template>-->
      <!--          <template slot='receivedGoodsName' slot-scope='text, record, index'>-->
      <!--            <a-input v-model='record.receivedGoodsName' :disabled="disableSubmit"  placeholder='收货人姓名' style='width: 100%'>-->
      <!--            </a-input>-->
      <!--          </template>-->
      <!--          <template slot='receivedGoodsTel' slot-scope='text, record, index'>-->
      <!--            <a-input v-model='record.receivedGoodsTel' :disabled="disableSubmit"  placeholder='收货人电话' style='width: 100%'>-->
      <!--            </a-input>-->
      <!--          </template>-->
      <!--          <template slot='receivedGoodsPhone' slot-scope='text, record, index'>-->
      <!--            <a-input v-model='record.receivedGoodsPhone' :disabled="disableSubmit"  placeholder='收货人手机' style='width: 100%'>-->
      <!--            </a-input>-->
      <!--          </template>-->
      <!--          <template slot='maxPeerCar' slot-scope='text, record, index'>-->
      <!--            <a-input v-model='record.maxPeerCar' :disabled="disableSubmit"  placeholder='最大通行车辆' style='width: 100%'>-->
      <!--            </a-input>-->
      <!--          </template>-->
      <!--          <template slot='mileage' slot-scope='text, record, index'>-->
      <!--            <a-input v-model='record.mileage' :disabled="disableSubmit"  placeholder='里程' style='width: 100%'>-->
      <!--            </a-input>-->
      <!--          </template>-->
      <!--          <template slot='freight' slot-scope='text, record, index'>-->
      <!--            <a-input v-model='record.freight' :disabled="disableSubmit"  placeholder='运价' style='width: 100%'>-->
      <!--            </a-input>-->
      <!--          </template>-->
      <!--          <template slot='mainCarModels' slot-scope='text, record, index'>-->
      <!--            <a-input v-model='record.mainCarModels' :disabled="disableSubmit"  placeholder='主发车型' style='width: 100%'>-->
      <!--            </a-input>-->
      <!--          </template>-->
      <!--          <template slot='storageLocationCode' slot-scope='text, record, index'>-->
      <!--            <a-input v-model='record.storageLocationCode' :disabled="disableSubmit"  placeholder='库位编号（大写）' style='width: 100%'>-->
      <!--            </a-input>-->
      <!--          </template>-->
      <!--          <template slot='receivingPort' slot-scope='text, record, index'>-->
      <!--            <a-input v-model='record.receivingPort' :disabled="disableSubmit"  placeholder='收货港口' style='width: 100%'>-->
      <!--            </a-input>-->
      <!--          </template>-->
      <!--        </a-table>-->
      <!--      </a-tab-pane>-->

      <a-tab-pane key="3" tab="证件照片">
        <div class="table-operator" v-if="!disableSubmit">
          <a-button @click='handleAddRow("certificatePhotos")' type="primary">新增</a-button>
          <a-button @click="handleDeleteRow(2)" type="primary">删除</a-button>
        </div>
        <a-table bordered
                 rowKey="id"
                 :data-source="certificatePhotos"
                 :columns="idPhotoColumns"
                 :rowSelection="{selectedRowKeys: selectedRowKeys1, onChange: onSelectChange1}"
                 :pagination="false">
          <template slot="certificateName" slot-scope="text, record, index">
            <a-input v-model="record.certificateName" :disabled="disableSubmit" placeholder="证件名称" style="width: 100%">
            </a-input>
          </template>
          <template slot="date" slot-scope="text, record, index">
            <a-range-picker
              :value="[record.startTime, record.endTime]"
              format="YYYY-MM-DD"
              :disabled="disableSubmit"
              valueFormat="YYYY-MM-DD"
              @change="onMomentChange($event,index)"
            />
          </template>
          <template slot="fileId" slot-scope="text, record, index">
            <j-upload fileType="all"
                      :buttonVisible="true"
                      :number="1"
                      :showUploadList="false"
                      :disabled="disableSubmit"
                      @change="(url,list)=>handleFile(url,list,index)"
                      text="附件"></j-upload>
          </template>
          <template slot="remarks" slot-scope="text, record, index">
            <span v-if="record.fileEntity && record.fileEntity.fileUrl">
               <a :href="record.fileEntity.fileUrl" target="_blank">{{ record.fileEntity.fileName }}</a>
            </span>
          </template>
        </a-table>
      </a-tab-pane>
    </a-tabs>
  </j-modal>
</template>

<script>
import { getAction, httpAction, postAction } from '@/api/manage'
import { pick } from 'lodash'
import moment from 'moment'
import JTreeSelect from '@/components/cn-form/JTreeSelect'
import CnAreaLinkage from '@comp/cn-form/CnAreaLinkage'
import { isMobile, isPermit } from '@/utils/validate'
import UploadImage from '@/components/upload-image/UploadImage'
import JImageUpload from '@/components/cn-form/JImageUpload'
import Area from '@/components/utils/Area'
import JUpload from '@/components/cn-form/JUpload'

const generateUUID = function (withSeparator = true) {
  let d = new Date().getTime()
  d = (d + '').substring(5, (d + '').length)
  return d * 1
}
export default {
  name: 'terminal-modal',
  components: { JTreeSelect, CnAreaLinkage, UploadImage, JImageUpload, JUpload },
  data() {
    return {
      sendPro: false,
      ProductAdress: [],
      remarks: '',
      dataSurces2: [],
      formChoice: [],
      showCode: false,
      remembertext: '',
      dataSource: [],
      forms: {
        custName: '请选择',
        realName: '请选择',
        orgName: ''
      },
      dataSurces: [],
      // dataSurces3: [],
      manobjList: [0],
      belongRegion: undefined,
      // 财务表头
      financials: [{ id: generateUUID(false) }],
      financialColumns: [
        {
          title: '序号',
          dataIndex: '',
          key: 'rowIndex',
          width: 60,
          align: 'center',
          fixed: 'left',
          customRender: function (t, r, index) {
            return parseInt(index) + 1
          }
        },
        {
          title: '账户类型',
          dataIndex: 'accountType',
          align: 'center',
          width: '150px',
          scopedSlots: { customRender: 'accountType' }
        },
        {
          title: '经销商银行开户名称',
          dataIndex: 'customerBank',
          align: 'center',
          width: '150px',
          scopedSlots: { customRender: 'customerBank' }
        },
        {
          title: '经销商银行账号（基本户）',
          dataIndex: 'customerBankAccount',
          align: 'center',
          width: '200px',
          scopedSlots: { customRender: 'customerBankAccount' }
        },
        {
          title: '开票类型',
          dataIndex: 'makeInvoiceType',
          align: 'center',
          width: '150px',
          scopedSlots: { customRender: 'makeInvoiceType' }
        },
        {
          title: '银行卡号',
          dataIndex: 'bankAccount',
          align: 'center',
          width: '150px',
          scopedSlots: { customRender: 'bankAccount' }
        },
        {
          title: '经销商开票名称（营业执照）',
          dataIndex: 'makeInvoiceName',
          align: 'center',
          width: '220px',
          scopedSlots: { customRender: 'makeInvoiceName' }
        },
        {
          title: '是否代结算',
          dataIndex: 'isAgentSettlement',
          align: 'center',
          width: '150px',
          scopedSlots: { customRender: 'isAgentSettlement' }
        },
        {
          title: '结算方式',
          dataIndex: 'settlementWay ',
          align: 'center',
          width: '150px',
          scopedSlots: { customRender: 'settlementWay' }
        },
        {
          title: '发票邮寄地址',
          dataIndex: 'invoiceMailAddress',
          align: 'center',
          width: '150px',
          scopedSlots: { customRender: 'invoiceMailAddress' }
        },
        {
          title: '纳税人类型',
          dataIndex: 'taxpayerType',
          align: 'center',
          width: '150px',
          scopedSlots: { customRender: 'taxpayerType' }
        },
        {
          title: '经销商纳税人识别号',
          dataIndex: 'customerTaxpayerNum',
          align: 'center',
          width: '150px',
          scopedSlots: { customRender: 'customerTaxpayerNum' }
        },
        {
          title: '增值税开票电话',
          dataIndex: 'vatInvoiceTel',
          align: 'center',
          width: '150px',
          scopedSlots: { customRender: 'vatInvoiceTel' }
        },
        {
          title: '发票收件人',
          dataIndex: 'invoiceRecipients',
          align: 'center',
          width: '150px',
          scopedSlots: { customRender: 'invoiceRecipients' }
        },
        {
          title: '发票联系人手机号',
          dataIndex: 'invoiceRecipientsPhone',
          align: 'center',
          width: '150px',
          scopedSlots: { customRender: 'invoiceRecipientsPhone' }
        },
        {
          title: '发票联系人电子邮箱',
          dataIndex: 'invoiceRecipientsEmail',
          align: 'center',
          width: '150px',
          scopedSlots: { customRender: 'invoiceRecipientsEmail' }
        }
      ],
      gAddColumns: [
        {
          title: '送达方编号',
          dataIndex: 'deliveryCode',
          align: 'center',
          width: '150px',
          scopedSlots: { customRender: 'deliveryCode' }
        },
        {
          title: '办公地址',
          dataIndex: 'officeAddress',
          align: 'center',
          width: '150px',
          scopedSlots: { customRender: 'officeAddress' }
        },
        {
          title: '收货地址',
          dataIndex: 'receivedGoodsAddress',
          align: 'center',
          width: '150px',
          scopedSlots: { customRender: 'receivedGoodsAddress' }
        },
        {
          title: '详细地址',
          dataIndex: 'addressDetailed',
          align: 'center',
          width: '150px',
          scopedSlots: { customRender: 'addressDetailed' }
        },
        {
          title: '运费计算城市',
          dataIndex: 'freightCalCity',
          align: 'center',
          width: '150px',
          scopedSlots: { customRender: 'freightCalCity' }
        },
        {
          title: '收货人姓名',
          dataIndex: 'receivedGoodsName',
          align: 'center',
          width: '150px',
          scopedSlots: { customRender: 'receivedGoodsName' }
        },
        {
          title: '收货人电话',
          dataIndex: 'receivedGoodsTel',
          align: 'center',
          width: '150px',
          scopedSlots: { customRender: 'receivedGoodsTel' }
        },
        {
          title: '收货人手机',
          dataIndex: 'receivedGoodsPhone',
          align: 'center',
          width: '150px',
          scopedSlots: { customRender: 'receivedGoodsPhone' }
        },
        {
          title: '最大通行车辆',
          dataIndex: 'maxPeerCar',
          align: 'center',
          width: '150px',
          scopedSlots: { customRender: 'maxPeerCar' }
        },
        {
          title: '里程',
          dataIndex: 'mileage',
          align: 'center',
          width: '150px',
          scopedSlots: { customRender: 'mileage' }
        },
        {
          title: '运价',
          dataIndex: 'freight',
          align: 'center',
          width: '150px',
          scopedSlots: { customRender: 'freight' }
        },
        {
          title: '主发车型',
          dataIndex: 'mainCarModels',
          align: 'center',
          width: '150px',
          scopedSlots: { customRender: 'mainCarModels' }
        },
        {
          title: '库位编号（大写）',
          dataIndex: 'storageLocationCode',
          align: 'center',
          width: '150px',
          scopedSlots: { customRender: 'storageLocationCode' }
        },
        {
          title: '收货港口',
          dataIndex: 'receivingPort',
          align: 'center',
          width: '150px',
          scopedSlots: { customRender: 'receivingPort' }
        }
      ],
      idPhotoColumns: [
        {
          title: '序号',
          dataIndex: '',
          key: 'rowIndex',
          width: 60,
          align: 'left',
          customRender: function (t, r, index) {
            return parseInt(index) + 1
          }
        },
        {
          title: '证件名称',
          dataIndex: 'certificateName',
          align: 'center',
          width: 200,
          scopedSlots: { customRender: 'certificateName' }
        },
        {
          title: '有效期',
          dataIndex: 'date',
          width: 300,
          scopedSlots: { customRender: 'date' }
        },
        {
          title: '附件',
          dataIndex: 'fileId',
          align: 'center',
          width: 200,
          scopedSlots: { customRender: 'fileId' }
        },
        {
          title: '备注',
          dataIndex: 'remarks',
          align: 'center',
          width: 200,
          scopedSlots: { customRender: 'remarks' }
        }

      ],
      certificatePhotos: [],
      areaData: '',
      areaLinkage: '',
      title: '操作',
      visible: false,
      model: {},
      labelCol: {
        xs: { span: 24 },
        sm: { span: 9 }
      },
      wrapperCol: {
        xs: { span: 24 },
        sm: { span: 14 }
      },
      confirmLoading: false,
      form: this.$form.createForm(this),
      selectedRowKeys: [],
      selectedRowKeys1: [],
      selectionRows1: [],
      selectionRows: [],
      validatorRules: {
        telephone: {
          rules: [
            { required: true, message: '', trigger: 'submit' },
            {
              validator: function (rule, value, callback) {
                if (!isMobile(value)) {
                  callback(new Error(''))
                }
                callback()
              }
            }
          ]
        },
        businessLicense: {
          rules: [
            { required: true, message: '', trigger: 'submit' },
            {
              validator: function (rule, value, callback) {
                if (!isPermit(value)) {
                  callback(new Error(''))
                }
                callback()
              }
            }
          ]
        },
        terminalName: {
          rules: [
            { required: true, message: '' }
          ]
        },
        warehouseName: {
          rules: [
            { required: true, message: '' }
          ]
        },
        address: {
          rules: [
            { required: true, message: '' }
          ]
        },
        linkman: {
          rules: [
            { required: true, message: '' }
          ]
        },
        telphone: {
          rules: [
            { required: true, message: '' }
          ]
        },
        dictDataCode: {
          rules: [
            { required: true, message: '' }
          ]
        },
        terminalType: {
          rules: [
            { required: true, message: '' }
          ]
        },
        terminalLevel: {
          rules: [
            { required: true, message: '' }
          ]
        },
        store: {
          rules: [
            { required: true, message: '' }
          ]
        },
        orgCode: {
          rules: [
            { required: true, message: '' }
          ]
        }
      },
      addOrUpdateUrl: window._CONFIG['domianURL'] + '/customer/cnCustomer/saveOrUpdate'
    }
  },

  created() {
    this.initAreaData()
    // console.log(this.areaData);
  },
  methods: {
    moment,
    handleDeleteRow(index) {
      if (index == 1) {
        this.selectedRowKeys.forEach(id => {
          let index = this.financials.findIndex(item => item.id == id)
          if (index != -1) {
            this.financials.splice(index, 1)
          }
        })
        this.selectedRowKeys = []
        this.selectionRows = []
        return
      }
      if (index == 2) {
        this.selectedRowKeys1.forEach(id => {
          let index = this.certificatePhotos.findIndex(item => item.id == id)
          if (index != -1) {
            this.certificatePhotos.splice(index, 1)
          }
        })
        this.selectedRowKeys1 = []
        this.selectionRows1 = []

      }
    },
    handleFile(list, fileList, index) {
      console.log(list, fileList)
      let data = {
        fileName: fileList[0].name,
        fileUrl: fileList[0].url,
        fileTypeName: fileList[0].type,
        fileSize: fileList[0].size,
        fileSuffix: fileList[0].name.split('.')[1],
      }
      this.$set(this.certificatePhotos[index], 'fileEntity', data)

    },
    onMomentChange(date, index) {
      this.$set(this.certificatePhotos[index], 'startTime', `${date[0]} 00:00:00`)
      this.$set(this.certificatePhotos[index], 'endTime', `${date[1]} 23:59:59`)
    },
    handlePca(code) {
      this.model.province = this.areaData.getText(code).split('/')[0]
      this.model.city = this.areaData.getText(code).split('/')[1]
      this.model.area = this.areaData.getText(code).split('/')[2]
    },
    randomHexColor() { //随机生成十六进制颜色
      var hex = Math.floor(Math.random() * 16777216).toString(16) //生成ffffff以内16进制数
      while (hex.length < 6) { //while循环判断hex位数，少于6位前面加0凑够6位
        hex = '0' + hex
      }
      return '#' + hex //返回‘#'开头16进制颜色
    },
    add() {
      this.edit({})
    },
    edit(record) {
      this.form.resetFields()
      this.model = Object.assign({}, record)
      this.belongRegion=''
      this.visible = true
      this.$nextTick(() => {
        if (record.id) {
          if(this.model.belongRegion){
            this.belongRegion = this.areaData.getAreaCodeByText(this.model.belongRegion) || ''
          }
          this.financials = record.financials
          this.certificatePhotos = record.certificatePhotos
        }
        setTimeout(() => {
          this.form.setFieldsValue(pick(this.model, Object.keys(this.model)))
          //时间格式化
        }, 200)
      })
    },
    close() {
      this.$emit('close')
      this.visible = false
      this.financials = [{ id: generateUUID(false) }]
      this.certificatePhotos = []
    },

    onSelectChange1(selectedRowKeys, selectionRows) {
      this.selectedRowKeys1 = selectedRowKeys
      this.selectionRows1 = selectionRows
    },
    onSelectChange(selectedRowKeys, selectionRows) {
      this.selectedRowKeys = selectedRowKeys
      this.selectionRows = selectionRows
    },

    handleOk() {
      const that = this
      // 触发表单验证
      this.form.validateFields((err, values) => {
        if (!err) {
          that.confirmLoading = true
          let method = ''
          if (!this.model.id) {
            method = 'post'
          } else {
            method = 'post'
          }
          let formData = Object.assign(this.model, values, {
            financials: this.financials,
            certificatePhotos: this.certificatePhotos,
          })
          if (this.model.province) {
            formData.belongRegion = `${this.model.province}/${this.model.city}/${this.model.area}`
          }
          httpAction(this.addOrUpdateUrl, formData, method).then((res) => {
            if (res.success) {
              that.$message.success(res.message)
              that.$emit('ok')
            } else {
              that.$message.warning(res.message)
            }
          }).finally(() => {
            that.confirmLoading = false
          })
        }
      })
    },

    handleCancel() {
      this.close()
    },
    initAreaData() {
      if (!this.areaData) {
        this.areaData = new Area()
      }
    },

    // 新增行
    handleAddRow(name) {
      console.log(this[name])
      this[name].push({ id: generateUUID(false) })
    }

  }
}
</script>

<style scoped>
.gonghuoxinxi {
  width: 100%;
  border-bottom: 1px dashed black;
  margin: 10px 0;
  padding: 15px 5px;
  display: flex;
  flex-direction: column;
}
</style>
